﻿<%@ Page Title="PO" Language="C#" MasterPageFile="~/TableMaster.master" AutoEventWireup="true" CodeFile="PO.aspx.cs" Inherits="Pages_PO" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
     <style>
        @media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) {

            .resTbl tr:nth-of-type(odd) {
                background-color: #CDE2FF;
            }

            .resTbl tr:nth-of-type(1) {
                display: none;
            }
             .resTbl td:nth-of-type(1):before {
                content: "PO_ID";
            }
            .resTbl td:nth-of-type(2):before {
                content: "PURCHASE ORDER NO";
            }

            .resTbl td:nth-of-type(3):before {
                content: "CLIENT CODE";
            }

            .resTbl td:nth-of-type(4):before {
                content: "COMPANY NAME ";
            }

            .resTbl td:nth-of-type(5):before {
                content: "CLIENT ADDRESS ";
            }

            .resTbl td:nth-of-type(6):before {
                content: "CONTACT DETAILS ";
            }

            .resTbl td:nth-of-type(7):before {
                content: "PRODUCT NAME ";
            }

            /*.resTbl td:nth-of-type(8):before {
                content: "MILL TYPE ";
            }*/

            .resTbl td:nth-of-type(8):before {
                content: "IS SAMPLE ? ";
            }

            .resTbl td:nth-of-type(9):before {
                content: "ORDERED QUANTITY ";
            }

             .resTbl td:nth-of-type(10):before {
                content: "Currency";
            }

            .resTbl td:nth-of-type(11):before {
                content: "PRICE PER KG";
            }

             .resTbl td:nth-of-type(12):before {
                content: "PAYMENT TERMS";
            }

            .resTbl td:nth-of-type(13):before {
                content: "DELIVERY DATE";
            }
             .resTbl td:nth-of-type(14):before {
                content: "PARTIAL PAYMENT ?";
            }
              .resTbl td:nth-of-type(15):before {
                content: "PRODUCTION RELEASE DATE";
            }
               .resTbl td:nth-of-type(16):before {
                content: "SHIPPING TYPE";
            }
                .resTbl td:nth-of-type(17):before {
                content: "SHIPPING TERMS";
            }
                 .resTbl td:nth-of-type(18):before {
                content: "CREATED DATE";
            }
                  .resTbl td:nth-of-type(19):before {
                content: "CREATED BY";
            }
              
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Add" runat="Server">

    <asp:Panel ID="pnlAdd" runat="server">

        <asp:UpdatePanel ID="updContent" runat="server">
            <ContentTemplate>
                <table cellpadding="0" cellspacing="0" style="width: 100%;">

                    <%-- <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPO_ID" runat="server" AssociatedControlID="txtPO_ID" Text="PO ID:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPO_ID" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblUSER_CODE" runat="server" AssociatedControlID="txtUSER_CODE" Text="User Code:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtUSER_CODE" runat="server"></asp:TextBox>
                </td>
            </tr>--%>
                    <asp:HiddenField ID="hdnPoID" runat="server" />
                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblClient" runat="server" AssociatedControlID="ddl_User" Text="Customer"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddl_User" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddl_User_SelectedIndexChanged"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Literal ID="litClientDetails" runat="server"></asp:Literal>
                        </td>

                    </tr>
                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblPURCHASE_ORDER_NO" runat="server" AssociatedControlID="txtPURCHASE_ORDER_NO" Text="Purchase Order No:"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtPURCHASE_ORDER_NO" runat="server"></asp:TextBox>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblIS_SAMPLE" runat="server" AssociatedControlID="chkIS_SAMPLE" Text="Is Sample?:"></asp:Label>
                        </td>
                        <td>
                            <asp:CheckBox ID="chkIS_SAMPLE" runat="server"></asp:CheckBox>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lbl_ProductName" runat="server" AssociatedControlID="ddl_ProductName" Text="Product Name:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddl_ProductName" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddl_ProductName_SelectedIndexChanged"></asp:DropDownList>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblPurity" runat="server" AssociatedControlID="ddl_Purity" Text="Purity:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddl_Purity" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddl_Purity_SelectedIndexChanged"></asp:DropDownList>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblPsd" runat="server" AssociatedControlID="ddl_Psd" Text="Particle Size:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddl_Psd" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddl_Psd_SelectedIndexChanged"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lbl_surface" runat="server" AssociatedControlID="ddl_Surface" Text="Surface Area:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddl_Surface" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddl_Surface_SelectedIndexChanged"></asp:DropDownList>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lbl_Grade" runat="server" AssociatedControlID="txtGrade" Text="Grade:"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtGrade" runat="server" ReadOnly ="true"></asp:TextBox>
                        </td>
                    </tr>
                  <%--  <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lbl_MillType" runat="server" AssociatedControlID="ddl_MillType" Text="Mill Type:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddl_MillType"  runat="server" ></asp:DropDownList>
                        </td>
                    </tr>--%>

                  
                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblQUANTITY" runat="server" AssociatedControlID="txtQUANTITY" Text="Quantity:"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtQUANTITY"   type="number" step="1" min="0" Validate ="Number" runat="server"></asp:TextBox>
                        </td>
                    </tr>

                      

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblPRICE_PER_KG" runat="server" AssociatedControlID="txtPRICE_PER_KG" Text="Price Per Kg:"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtPRICE_PER_KG" type="number" step="0.01" min="0"  runat="server"></asp:TextBox>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblPAYMENT_TERM_ID" runat="server" AssociatedControlID="ddlPAYMENT_TERM_ID" Text="Payment Terms:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlPAYMENT_TERM_ID" runat="server"></asp:DropDownList>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblDELIVERY_DATE" runat="server" AssociatedControlID="txtDELIVERY_DATE" Text="Delivery Date:"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtDELIVERY_DATE" type="date"  runat="server"></asp:TextBox>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblPARTIAL_PAYMENT" runat="server" AssociatedControlID="chkPARTIAL_PAYMENT" Text="Partial Shipment?:"></asp:Label>
                        </td>
                        <td>
                            <asp:CheckBox ID="chkPARTIAL_PAYMENT" runat="server"></asp:CheckBox>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblSHIPPING_ID" runat="server" AssociatedControlID="ddlSHIPPING_ID" Text="Shipping Type:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlSHIPPING_ID" runat="server"></asp:DropDownList>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblSHIPPING_TERMS_ID" runat="server" AssociatedControlID="ddlSHIPPING_TERMS_ID" Text="Shipping Terms:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlSHIPPING_TERMS_ID" runat="server"></asp:DropDownList>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                            <asp:Label ID="lblPRODUCTION_RELESE_DATE" runat="server" AssociatedControlID="txtPRODUCTION_RELESE_DATE" Text="Production Release Date:"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txtPRODUCTION_RELESE_DATE" type="date" runat="server"></asp:TextBox>
                        </td>
                    </tr>

                    <tr>
                        <td style="width: 170px">
                              <asp:Label ID="lblCurrency" runat="server" AssociatedControlID="ddlCurrency" Text="Currency:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlCurrency" required="required" DataSourceID="Ds_currency" DataTextField="CURRENCY_NAME" DataValueField="CURRENCY_ID" OnDataBound="ddlcurrency_DataBound" runat="server"></asp:DropDownList>
                             <asp:ObjectDataSource ID="Ds_currency" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_currency_master"></asp:ObjectDataSource>
                        </td>
                    </tr>
                    <%--<tr>
                <td style="width: 170px">
                    <asp:Label ID="lblCREATED_DATE" runat="server" AssociatedControlID="txtCREATED_DATE" Text="Created Date:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtCREATED_DATE" runat="server"></asp:TextBox>
                </td>
            </tr>--%>

                    <%--<tr>
                <td style="width: 170px">
                    <asp:Label ID="lblCREATED_BY" runat="server" AssociatedControlID="txtCREATED_BY" Text="Created By:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtCREATED_BY" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblACCEPTED_BY" runat="server" AssociatedControlID="txtACCEPTED_BY" Text="Accepted By:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtACCEPTED_BY" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblACCEPTED_DATE" runat="server" AssociatedControlID="txtACCEPTED_DATE" Text="Accepted Date:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtACCEPTED_DATE" runat="server"></asp:TextBox>
                </td>
            </tr>--%>


                    <tr>
                        <td style="width: 170px">&nbsp;</td>
                        <td>

                            <asp:Button ID="btnSave" runat="server" CssClass="btn btn-success" OnClick="btnSave_Click" Text="Save" Width="90px" />
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-danger" OnClick="btnCancel_Click" Text="Cancel" Width="90px" />

                        </td>
                    </tr>

                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="updprogress" AssociatedUpdatePanelID="updContent" runat="server">
            <ProgressTemplate>
                <div style="position: absolute; width: 100%; height: 100%;">

                    <img style="position: relative; top: 45%;" alt="Processing Request" src="../Images/Progress.gif" />

                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>

    </asp:Panel>

</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Grid" runat="Server">


    <asp:Panel ID="pnlList" runat="server">
        <asp:GridView ID="gridClients" runat="server" AutoGenerateColumns="False" CssClass="resTbl"  DataSourceID="DS_tbl_purchase_order">
            <Columns>
                <asp:BoundField DataField="PO_ID" HeaderText="PO ID" SortExpression="PO_ID" />
                <asp:BoundField DataField="PURCHASE_ORDER_NO" HeaderText="PURCHASE_ORDER_NO" SortExpression="PURCHASE_ORDER_NO" />
                <asp:BoundField DataField="CUSTOMER" HeaderText="USER_CODE" SortExpression="CUSTOMER" />
                <asp:BoundField DataField="COMPANY_NAME" HeaderText="COMPANY_NAME" SortExpression="COMPANY_NAME" />
                <asp:BoundField DataField="ADDRESS" HeaderText="ADDRESS" SortExpression="ADDRESS" />
                <asp:BoundField DataField="CONTACT_DETAILS" HeaderText="CONTACT_DETAILS" SortExpression="CONTACT_DETAILS" />
                <asp:BoundField DataField="PRODUCT_NAME" HeaderText="PRODUCT_NAME" SortExpression="PRODUCT_NAME" />
                <%--<asp:BoundField DataField="MILL_TYPE" HeaderText="MILL_TYPE" SortExpression="MILL_TYPE" />--%>
                <asp:BoundField DataField="IS_SAMPLE" HeaderText="IS_SAMPLE" SortExpression="IS_SAMPLE"  />
                <asp:BoundField DataField="QUANTITY" HeaderText="QUANTITY" SortExpression="QUANTITY" />
                <asp:BoundField DataField="CURRENCY" HeaderText="CURRENCY" SortExpression="CURRENCY" />
                <asp:BoundField DataField="PRICE_PER_KG" HeaderText="PRICE_PER_KG" SortExpression="PRICE_PER_KG" />
                <asp:BoundField DataField="PAYMENT_TERM" HeaderText="PAYMENT_TERM" SortExpression="PAYMENT_TERM" />
                <asp:BoundField DataField="DELIVERY_DATE" HeaderText="DELIVERY_DATE" SortExpression="DELIVERY_DATE"  />
                <asp:BoundField DataField="PARTIAL_PAYMENT" HeaderText="PARTIAL_PAYMENT" SortExpression="PARTIAL_PAYMENT" />
                <asp:BoundField DataField="PRODUCTION_RELEASE_DATE" HeaderText="PRODUCTION_RELEASE_DATE" SortExpression="PRODUCTION_RELEASE_DATE" />
                <asp:BoundField DataField="SHIPPING_TYPE" HeaderText="SHIPPING_TYPE" SortExpression="SHIPPING_TYPE" />
                <asp:BoundField DataField="SHIPPING_TERMS" HeaderText="SHIPPING_TERMS" SortExpression="SHIPPING_TERMS" />
                <asp:BoundField DataField="CREATED_DATE" HeaderText="CREATED_DATE" DataFormatString="{0:yyMMdd}" HtmlEncode="false" SortExpression="CREATED_DATE" />
                <asp:BoundField DataField="CREATED_BY" HeaderText="CREATED_BY" SortExpression="CREATED_BY" />
                 <asp:TemplateField HeaderText="Edit">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkEdit" runat="server" Text="Edit" CommandArgument='<%# Eval("PO_ID") %>' OnClick="linkEdit_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkDelete" CommandName="delete" runat="server" Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');" CommandArgument='<%# Eval("PO_ID") %>' OnClick="linkDelete_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="DS_tbl_purchase_order" runat="server" SelectMethod="selectAll"  DeleteMethod="delete" TypeName="DAL_tbl_purchase_order">
             <DeleteParameters>
                <asp:Parameter Name="PO_ID" Type="Int32" />
            </DeleteParameters>

        </asp:ObjectDataSource>
    </asp:Panel>

</asp:Content>

